package com.nit.controller;


import com.nit.dto.utils.TableRequestDTO;
import com.nit.dto.utils.TableResponseDTO;
import com.nit.service.ShopGoodsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "/api/shopGoods")
public class ShopGoodsController {

    @Resource
    private ShopGoodsService shopGoodsService;
    private final Logger logger = LoggerFactory.getLogger(ShopGoodsController.class);


    @RequestMapping(value = "/query", method = RequestMethod.POST)
    public TableResponseDTO query(@RequestBody TableRequestDTO tableRequestDTO){
        TableResponseDTO tableResponseDTO = new TableResponseDTO();
        try {
            tableResponseDTO = shopGoodsService.query(tableRequestDTO);
        } catch (Exception e){
            logger.error(e.toString());
        }
        return tableResponseDTO;
    }
}
